<template>
	<view>
		<!-- 顶部信息 -->
		<view class="top">
			<view class="uni-flex ">
				<view class="flex-item one">
					审核通过
					<view>
						{{score}}分
						<view v-if="score>=4" >（已修满）</view>
						<view v-else-if="score<4">（未修满）</view>
					</view>
				</view>
				<view class="line line_left">|</view>
				<view class="flex-item two">
					审核中或未审核
					<view>{{noPass}}分</view>
				</view>
				<view class="line line_right">|</view>
				<view class="flex-item three">
					退回
					<view>{{quit}}分</view>
				</view>
			</view>
		</view>
		<!-- 具体素拓分数据 -->
		<view class="showData">
			<view class="flex-item-V uni-flex  score_show" v-for="(item,index) in rows" :key="item.id">
				<view class="show uni-bg-red">
					{{item.ktmc}}
					<view style="font-size: 30rpx;">
						状态:{{item.shztmc}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{item.xmjbmc}}
					</view>
				</view>
				<view class="score">{{item.hdxf}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pass:'', // 审核通过
				noPass: '0', // 审核未通过
				quit:'0', // 退回
				rows:[], // 返回素拓分数据
				total: 0, // 学年素拓分个数
				xnxqdm:'', // 查询学年数素拓数据
				term:[202001,202002,201901,201902,201801,201802,201701,201702] // 学期数
			}
		},
		onLoad(){
			// this.getScore()
			this.postTerm()
		},
		methods: {
			async getScore(){
				const res = await this.$schoolRequest({
					url:'/xsktsbxx!getYxktDataList.action',
					method:'POST',
					data:{
						xnxqdm:this.xnxqdm,
						page:1,
						rows:20,
						sort:"cjsj",
						order:"desc"
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'X-Requested-With': 'XMLHttpRequest',
						'Cookie': uni.getStorageSync("sessionid"),
					},
					success: (res) => {
						this.rows = this.rows.concat(res.data.rows)	//整合所有素拓数据				
						this.total += res.data.total
						console.log(this.total,this.rows)
					},
					fail: (err) => {
						console.log(err)
					}
				})
			},
			// 遍历学年学期数
			postTerm(){
				for(let i = 0;i<this.term.length;i++){
					this.xnxqdm = this.term[i]
					this.getScore()
				}
			}
		},
		computed:{
			// 计算通过审核素拓分
			score:function(){
				let pass = 0;
				for(let i =0;i<this.rows.length;i++){
					pass+=parseFloat(this.rows[i].hdxf)
				}
				return pass
			},
			// 计算还在审核中的素拓分
			// noPass: function(){
			// 	let noPass = 0;
				
			// }
		}
	}
</script>

<style lang="scss">
	.top {
		/* width:690rpx; */
		padding: 0;
		height: 100rpx;
		.uni-flex {
			display: flex;
			flex-direction: row;
			.flex-item {
					height: 100%;
					text-align: center;
					// border-right: 1px solid black;
					//line-height: 100px;
			}
			.one,.three{
				width: 30%;
			}
			.two{
				width: 40%;
			}
			.line{
				line-height: 80rpx;
			}
			.line_left{
				padding-right: 40rpx;
			}
			.line_right{
				padding-left: 40rpx;
			}
		}
	}
	.showData{
		.flex-item-V {
			width: 90%;
			height: 150rpx;
			margin: 10px auto;
			border: 1px solid $uni-bg-color-mask;
			border-radius: 10px;
		}
		.uni-flex {
			display: flex;
			flex-direction: row;
		}
		.score_show {
			.score {
				//width: 20%;
				margin: 50rpx auto;
			}
		
			.show {
				width: 80%;
			}
			.uni-bg-red {
				background: #F76260;
				color: #FFF;
			}
		}
	}
</style>
